// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   CreateFile.java

package include.nseer_cookie;

import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;

public class CreateFile
{

	public CreateFile()
	{
	}

	public void toFile(String xml_path, String source_value, String replace_value)
	{
		ArrayList cont = new ArrayList();
		try
		{
			RandomAccessFile filee = new RandomAccessFile(xml_path, "r");
			long filePointer = 0L;
			for (long length = filee.length(); filePointer < length; filePointer = filee.getFilePointer())
			{
				String mk = filee.readLine();
				byte str[] = mk.getBytes("8859_1");
				String content = new String(str, "utf8");
				if (content.indexOf(source_value) != -1)
				{
					content = content.replace(source_value, replace_value);
					cont.add(content);
				} else
				{
					cont.add(content);
				}
			}

			FileOutputStream fo = new FileOutputStream(xml_path);
			Writer so = new OutputStreamWriter(fo, "UTF-8");
			String option;
			for (Iterator iterator = cont.iterator(); iterator.hasNext(); so.write((new StringBuilder(String.valueOf(option))).append("\r\n").toString()))
				option = (String)iterator.next();

			so.close();
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}

	public static void main(String args[])
	{
		try
		{
			CreateFile cc = new CreateFile();
			cc.toFile("E:\\3333.jsp", "", "");
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
